﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        txtuser.Focus();
        if(Session["usr"]!=null)
        {
            Response.Write("<script>alert('您已经登陆，退出后重试');location.href='"+Request.UrlReferrer.ToString()+"';</script>");
        }
    }

    protected void sumbit_Click(object sender, EventArgs e)
    {
        if(func.Login_usr(txtuser.Text.Trim(),txtpass.Text.Trim()))
        {
            Session["usr"] = txtuser.Text.Trim();
            Response.Redirect("user_func.aspx");
        }
        else
        {

            Response.Write("<script>alert('用户名或密码错误')</script>");
        }
    }
}